package com.heima.api.client;

import com.heima.api.config.DefaultFeignConfig;
import com.heima.api.dto.CartFormDTO;
import com.heima.api.fallback.CartClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import javax.validation.Valid;
import java.util.Collection;
import java.util.List;

@FeignClient(value = "cart-service", fallbackFactory = CartClientFallback.class,configuration = DefaultFeignConfig.class)
public interface CartClient {

    @DeleteMapping("/carts")
    public void deleteCartItemByIds(@RequestParam("ids") Collection<Long> ids);

    @PostMapping
    public void addItem2Cart(@Valid @RequestBody CartFormDTO cartFormDTO);
}
